const Koa = require('koa');
const Router = require('koa-router');
const BodyParser = require('koa-bodyparser')
const addControllers = require('./controller').addControllers
const nunjucksMiddreware = require('./middleware/nunjucks')
const staticMiddleware = require('./middleware/static')
const Config = require('./config')

const app = new Koa();
const router = new Router();
app.use(staticMiddleware('/static/', Config.static))

app.use(nunjucksMiddreware)

app.use(new BodyParser())

addControllers(router)
app.use(router.routes()).use(router.allowedMethods())

app.listen(3000)